<?php

class Agent_NetworkController extends Zend_Controller_Action
{
	public function init()
	{
        $authData = Zend_Auth::getInstance()->getStorage()->read();
		if (is_array($authData) and $authData['identity'] != 'anon' and strtolower($authData['userType']) == 'agnt'){
			$_SESSION['agent_reg_id'] = $authData['identity']; 
        } 
	}
	
	public function indexAction()
	{
		
		$agent = new Reale_Model_Users_Agent();
		$agent->setAgent_reg_id($_SESSION['agent_reg_id']);
		$downLine = $agent->fetchDownLine(null);
		//$this->_helper->logger($downLine);
		//$network_stats = $agent->networkStat();
		$this->view->assign('downline',$downLine);
		//$this->view->assign('netstats',$network_stats);
		
		//$this->view->assign('total_nodes',$network_stats['depth_1']);		
	}
	
	public function treeAction()
	{
		
	}
}